package edu.tgc.entity.qrtz;

import java.util.UUID;

import javax.persistence.ManyToOne;
import javax.persistence.Transient;

import org.quartz.JobKey;

import edu.tgc.entity.system.AbstractPersistableEntity;

public class QrtzJob extends AbstractPersistableEntity<UUID> {

    private static final long serialVersionUID = 4250088489615872207L;
    protected String className;
    protected String description;
    // 可持续
    protected Boolean durable;

    protected QrtzGroup group;
    protected String name;
    // 可恢复
    protected Boolean recovery;

    public String getClassName() {
        return this.className;
    }

    public String getDescription() {
        return this.description;
    }

    public Boolean getDurable() {
        return this.durable;
    }

    @ManyToOne
    public QrtzGroup getGroup() {
        return this.group;
    }

    @Transient
    public JobKey getJobKey() {
        return new JobKey(this.getId().toString(), this.group == null ? null : this.group.getId().toString());
    }

    public String getName() {
        return this.name;
    }

    public Boolean getRecovery() {
        return this.recovery;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setDurable(Boolean durable) {
        this.durable = durable;
    }

    public void setGroup(QrtzGroup group) {
        this.group = group;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setRecovery(Boolean recovery) {
        this.recovery = recovery;
    }

}
